

package com.hazelcast.internal.monitor.impl;

/**
 * The implementation of operation index stats specialized for HD global indexes.
 */
public final class HDGlobalIndexOperationStats implements IndexOperationStats {

    private long entryCountDelta;

    @Override
    public long getEntryCountDelta() {
        return entryCountDelta;
    }

    @Override
    public long getMemoryCostDelta() {
        // Memory cost tracking for HD global indexes is done on the native memory
        // allocator level.
        return 0;
    }

    @Override
    public void onEntryAdded(Object addedValue) {
        ++entryCountDelta;
    }

    @Override
    public void onEntryRemoved(Object removedValue) {
        --entryCountDelta;
    }

    /**
     * Resets this stats instance to be ready for reuse.
     */
    public void reset() {
        entryCountDelta = 0;
    }

}
